# v0.25.0

# 功能测试

## MOSN 核心代码和 Istio 引入相关 xDS 代码解耦合

+ 构造新的镜像

```
make istio-1.5.2
make build
make image
```
+ 使用MOSN kata教程，将其中镜像替换为新镜像，参考[mosn-tutorial](https://github.com/mosn/mosn-tutorial)
+ 运行完整的bookinfo，符合预期 


## 集成 SEATA TCC 模式，支持 HTTP 协议

+ 参考[SEATA集成示例](https://github.com/mosn/mosn/tree/master/examples/cn_readme/seata)


## 优化Subset创建时的内存使用

```
2021-09-28 21:14:38,909 [INFO] [network] [ register pool factory] register protocol: mock factory
goos: darwin
goarch: amd64
pkg: mosn.io/mosn/pkg/upstream/cluster
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
BenchmarkFastSubsetLoadBalancer/fastSubsetLoadbalancer-12                    375           2731340 ns/op         2133367 B/op       1603 allocs/op
BenchmarkFastSubsetLoadBalancer/subsetLoadbalancer-12                         42          31325573 ns/op        14695644 B/op     141297 allocs/op
PASS
ok      mosn.io/mosn/pkg/upstream/cluster       4.376s
```

## 优化HTTP2 流式处理

运行集成测试[HTTP2集成测试CASE](https://github.com/mosn/mosn/blob/master/test/cases/simple/http2_test.go)

```
=== RUN   TestHttp2UseStream
    framework.go:95: setup scenario: http2 use stream 
2021-10-08 17:56:22,140 [INFO] register a new handler maker, name is default, is default: true 
2021-10-08 17:56:22,159 [INFO] [admin server] [register api] register a new api /server_info
2021-10-08 17:56:22,159 [INFO] mosn is builded in debug mosn 
2021-10-08 17:56:22,159 [INFO] [admin server] [register api] register a new api /debug/update_config
2021-10-08 17:56:22,159 [INFO] [admin server] [register api] register a new api /debug/disable_tls
2021-10-08 17:56:22,159 [INFO] [admin server] [register api] register a new api /debug/update_route
2021-10-08 17:56:22,159 [INFO] [config] processor added to configParsedCBMaps
2021-10-08 17:56:22,165 [INFO] [network] [ register pool factory] register protocol: Http1 factory
2021-10-08 17:56:22,165 [INFO] [network] [ register pool factory] register protocol: Http2 factory
2021-10-08 17:56:22,165 [INFO] [network] [ register pool factory] register protocol: X factory
2021-10-08 17:56:22,172 [INFO] register a grpc server named: hello, success: true 
2021-10-08 17:56:22,172 [INFO] register a grpc server named: echo, success: true 
2021-10-08 17:56:22,172 [INFO] register a new handler maker, name is check-handler, is default: false
2021-10-08 17:56:22,172 [INFO] [mosn] [start] xds service type must be sidecar or router
2021-10-08 17:56:22,172 [INFO] load config from :  /tmp/mosn_test_config.json
2021-10-08 17:56:22,173 [INFO] mosn parameters parsed cost: 932.765µs
2021-10-08 17:56:22,174 [ERROR] write pid file error: open /home/admin/mosn/logs/mosn.pid: no such file or directory
2021-10-08 17:56:22,174 [INFO] [mosn] [init tracing] disable tracing
2021-10-08 17:56:22,174 [INFO] [mosn start] create a new mosn structure
2021-10-08 17:56:22,174 [INFO] [server] [reconfigure] not reconfigure: dial unix /home/admin/mosn/conf/reconfig.sock: connect: no such file or directory
2021-10-08 17:56:22,174 [INFO] [mosn] [NewMosn] new mosn created
2021-10-08 17:56:22,174 [INFO] [mosn start] mosn init cluster structures
2021-10-08 17:56:22,174 [INFO] [config] [parse cluster] max_request_per_conn is not specified, use default value 1024 
2021-10-08 17:56:22,174 [INFO] [config] [parse cluster] conn_buffer_limit_bytes is not specified, use default value 16384
2021-10-08 17:56:22,174 [INFO] [cluster] [cluster manager] [AddOrUpdatePrimaryCluster] cluster server_cluster updated
2021-10-08 17:56:22,174 [INFO] [upstream] [host set] update host, final host total: 1
2021-10-08 17:56:22,174 [INFO] [cluster] [primaryCluster] [UpdateHosts] cluster server_cluster update hosts: 1
2021-10-08 17:56:22,174 [INFO] [mosn start] mosn init server structures
2021-10-08 17:56:22,175 [ERROR] StaticResources is null 
2021-10-08 17:56:22,175 [INFO] mosn init cost: 1.613977ms
2021-10-08 17:56:22,175 [INFO] [mosn start] mosn start xds client
2021-10-08 17:56:22,175 [ERROR] start xds failed: null point exception
2021-10-08 17:56:22,175 [WARN] [feature gate] feature XdsMtlsEnable is not enabled
2021-10-08 17:56:22,175 [WARN] [feature gate] feature PayLoadLimitEnable is not enabled
2021-10-08 17:56:22,175 [WARN] [feature gate] feature MultiTenantMode is not enabled
2021-10-08 17:56:22,175 [WARN] [feature gate] feature auto_config is not enabled
2021-10-08 17:56:22,175 [INFO] [mosn start] mosn parse extend config
2021-10-08 17:56:22,175 [INFO] mosn prepare to start cost: 34.148µs
2021-10-08 17:56:22,175 [INFO] [mosn start] mosn transfer connections
2021-10-08 17:56:22,175 [INFO] [mosn start] mosn clean upgrade datas
2021-10-08 17:56:22,175 [INFO] [mosn start] mosn start server
2021-10-08 17:56:22,175 [INFO] mosn start cost: 5.536µs
2021-10-08 17:56:23,176 [ERROR] [server] [reconfigure] reconfigureHandler net listen error: listen unix /home/admin/mosn/conf/reconfig.sock: bind: no such file or directory
    framework.go:97: run scenario: http2 use stream 
    framework.go:30: run case: client-mosn-server
    framework.go:32: finish case: client-mosn-server
--- PASS: TestHttp2UseStream (3.02s)
```

# 基准测试

+ 使用[sofaload](https://github.com/antJack/sofaload)在本地搭建简单的性能测试

```Bash
./sofaload -D 10 --qps=2000 -c 200 -t 16 -p sofarpc sofarpc://127.0.0.1:12200
```

```
starting benchmark...
Application protocol: sofarpc

finished in 10.01s, 2000.00 req/s, 2.41MB/s
requests: 20000 total, 20000 started, 20000 done, 20000 succeeded, 0 failed, 0 errored, 0 timeout
sofaRPC status codes:
	20000 success, 0 error, 0 server exception, 0 unknown
	0 server threadpool busy, 0 error comm, 0 no processor, 0 timeout
	0 client send error, 0 codec exception, 0 connection closed, 0 server serial exception
	0 server deserial exception
traffic: 24.11MB (25280000) total, 390.63KB (400000) headers (space savings 0.00%), 23.73MB (24880000) data
                     min         max         mean         sd        +/- sd
time for request:      129us     18.40ms       258us       459us    98.80%
time for connect:        4us       157us        30us        43us    88.00%
req/s           :       9.50       10.60       10.00        0.41    78.50%

  Latency  Distribution
   50%        197us
   75%        248us
   90%        330us
   95%        407us
   99%       1.40ms
```
